package com.student.controller;

import com.student.dto.ResponseDto;
import com.student.pojo.Artists;
import com.student.service.ArtistsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: SupportGroup
 * @BelongsPackage: com.student.controller
 * @Author: 小徐
 * @CreateTime: 2025-02-28 12:34
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("artists")
public class ArtistsController {
    @Autowired
    private ArtistsService artistsService;


    /**
     * 这边是显示艺人的所有信息
     *
     * @param artists
     * @return
     */
    @RequestMapping("artistsMessage")
    public ResponseDto artistsMessage(@RequestBody Artists artists) {
        return artistsService.artistsMessage(artists);
    }

    /**
     * 添加艺人信息
     *
     * @param artists
     * @return
     */
    @RequestMapping("addArtistsMessage")
    public ResponseDto addArtistsMessage(@RequestBody Artists artists) {

        return artistsService.addArtistsMessage(artists);
    }

    /**
     * 修改艺人信息
     *
     * @param artists
     * @return
     */
    @RequestMapping("updateArtistsMessage")
    public ResponseDto updateArtistsMessage(@RequestBody Artists artists) {
        System.err.println(artists);
        return artistsService.updateArtistsMessage(artists);
    }

    /**
     * 这边是删除艺人信息
     *
     * @param id
     * @return
     */
    @RequestMapping("deleteArtists")
    public ResponseDto deleteArtists(@RequestParam("id") Integer id) {
        return artistsService.deleteArtists(id);
    }

    @RequestMapping("getAllArtist")
    public  ResponseDto getAllArtist(){
        return artistsService.getAllArtist();
    }
}